package com.joinway.extension.socket.server.codec;

import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolCodecFactory;
import org.apache.mina.filter.codec.ProtocolDecoder;
import org.apache.mina.filter.codec.ProtocolEncoder;

public class CodecFactory implements ProtocolCodecFactory {

	protected ProtocolDecoder decoder;
	
	protected ProtocolEncoder encoder;
	
	public CodecFactory(ProtocolDecoder decoder, ProtocolEncoder encoder){
		this.decoder = decoder;
		this.encoder = encoder;
	}
	
	@Override
	public ProtocolDecoder getDecoder(IoSession session) throws Exception {
		return decoder;
	}

	@Override
	public ProtocolEncoder getEncoder(IoSession session) throws Exception {
		return encoder;
	}

}
